package com.ht.modules.alarmstatis.controller;

import com.ht.modules.alarmstatis.entity.*;
import com.ht.modules.alarmstatis.service.IAlarmStatisService;
import com.ht.entity.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *  报警统计
 * @Author:
 * @Date: 2024-01-11
 * @Version: V1.0
 */
@Slf4j
@RestController
@RequestMapping("/alarmstatis/alarmStatis")
public class AlarmStatisController {
    @Autowired
    private IAlarmStatisService alarmStatisService;
    /**
     * 报警总表
     */
    @GetMapping("/alarmMasterList")
    public Result<?> alarmMasterList(AlarmMaster alarmMaster) {
        return Result.ok(alarmStatisService.alarmMasterList(alarmMaster));
    }

    /**
     * 报警频次统计
     */
    @GetMapping("/alarmEquList")
    public Result<?> alarmEquList(AlarmEqu alarmEqu) {
        return Result.ok(alarmStatisService.alarmEquList(alarmEqu));
    }

    /**
     * 报警类型统计
     */
    @GetMapping("/alarmFromList")
    public Result<?> alarmFromList(AlarmFromStatis alarmFromStatis) {
        return Result.ok(alarmStatisService.alarmFromList(alarmFromStatis));
    }

    /**
     * 报警类型统计（分中心）
     */
    @GetMapping("/alarmFromCentreList")
    public Result<?> alarmFromCentreList(AlarmFromCentreStatis alarmFromCentreStatis) {
        return Result.ok(alarmStatisService.alarmFromCentreList(alarmFromCentreStatis));
    }

    /**
     * 报警分析－报警处置率
     */
    @GetMapping("/alarmDisposeRate")
    public Result<?> alarmDisposeRate(AlarmDisposeRate alarmDisposeRate) {
        return Result.ok(alarmStatisService.alarmDisposeRate(alarmDisposeRate));
    }

    /**
     * 报警分析-报警等级统计
     */
    @GetMapping("/alarmPriority")
    public Result<?> alarmPriority(AlarmPriority alarmPriority) {
        return Result.ok(alarmStatisService.alarmPriority(alarmPriority));
    }

    /**
     * 报警分析－KPI分析-班组KPI
     * 中心四个班组当班的报警次数和处置率
     */
    @GetMapping("/alarmKpiStatisTeam")
    public Result<?> alarmKpiStatisTeam(AlarmTeamStatis alarmTeamStatis) {
        return Result.ok(alarmStatisService.alarmKpiStatisTeam(alarmTeamStatis));
    }

    /**
     * 报警分析－KPI分析-中心KPI
     * 四个中心去统计报警次数和处置率
     */
    @GetMapping("/alarmKpiStatisCentre")
    public Result<?> alarmKpiStatisCentre(AlarmCentreStatis alarmCentreStatis) {
        return Result.ok(alarmStatisService.alarmKpiStatisCentre(alarmCentreStatis));
    }

    /**
     * 报警分析－KPI分析-横大班KPI
     * 横大班 每个中心的同一班次的总和成为一个横大班 一共4个横大班 对比4个的报警次数和处置率
     */
    @GetMapping("/alarmKpiStatisCrossTeam")
    public Result<?> alarmKpiStatisCrossTeam(AlarmCrossTeamStatis alarmCrossTeamStatis) {
        return Result.ok(alarmStatisService.alarmKpiStatisCrossTeam(alarmCrossTeamStatis));
    }

    /**
     * 年月周分析
     */
    @GetMapping("/alarmYearMonthWeekAnalysis")
    public Result<?> alarmYearMonthWeekAnalysis(AlarmYearMonthWeekAnalysis alarmYearMonthWeekAnalysis) {
        return Result.ok(alarmStatisService.alarmYearMonthWeekAnalysis(alarmYearMonthWeekAnalysis));
    }
}
